import 'package:easy_chat_app/commons/model/AppUserDetail.dart';
import 'package:easy_chat_app/commons/utils/HttpUtils.dart';
import 'package:flutter/foundation.dart';
import 'package:uuid/uuid.dart';

class GlobalStatus extends ChangeNotifier {
  GlobalStatus._providerConstruct();

  static final GlobalStatus instance = GlobalStatus._providerConstruct();

  static const Uuid _uuid = Uuid();

  String _version = _uuid.v1();

  String getVersion() {
    return _version;
  }

  void notify() {
    _version = _uuid.v1();
    notifyListeners();
  }
}

class AppUserDetailChangeNotifier extends ChangeNotifier {
  AppUserDetail? _appUserDetail;

  Future<void> reload() async {
    _appUserDetail = (await HttpUtils.getAppUserDetail()).data;
    notifyListeners();
  }

  AppUserDetail getAppUserDetail() {
    return _appUserDetail!;
  }
}
